package data;

import java.util.ArrayList;
import java.util.Iterator;

import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Row;

import fileIO.XLSParser;
import fileIO.CellIO;


/**
 * Retrieves employee data from stored XML files on launch
 * @author lax116
 */
public class ExceptionInfo {
	private static ArrayList<String> exceptionMap;
	
	public static void initialize(){
		exceptionMap = new ArrayList<String>();
		
		//FilePath.CS_LIST
		HSSFWorkbook ExceptionBook = XLSParser.openXLS(ConfigInfo.EXCEPTION_DIRECTORY);
		HSSFSheet eSheet = ExceptionBook.getSheetAt(0);
		Iterator<Row> rowIterator = eSheet.iterator();
		while (rowIterator.hasNext()){
			Row eRow = rowIterator.next();
			parseList(eRow);
		}
	}
	private static void parseList(Row row){		
		String keyStr = CellIO.keyGenerator(row);		
		if (!containKey(keyStr)){
			exceptionMap.add(keyStr);		
		}
	}	
	public static boolean containKey(String key){		
		return exceptionMap.contains(key);
	}
	public static void AddtoException(String keyS, ArrayList<Row>ArrList){
		//exceptionMap.put(keyS, ArrList);
	}
/*	public static void writeToFile(){
		EmailNoticeWriter.write(exceptionMap, 10);
		//EmployeeInfoWriter.write(shipmentMap,shipmentMap, EmployeeInfoWriter.CS);
	}
	*/
}
